<!DOCTYPE html>
<html class="x-admin-sm">
  <head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="__ADMIN__/css/font.css">
    <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
    <script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
    <style>
        .layui-btn+.layui-btn{
            margin-left: 0;
        }
        .layui-table td, .layui-table th
        {
            min-width: 50px !important;
        }
    </style>
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>{$nav}</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon layui-icon-refresh-3" style="line-height:30px"></i></a>
    </div>
    <div class="x-body x-admin">
        
      <xblock>
        <!--<button style="float:left;" class="layui-btn" onclick="x_admin_show('申请礼品寄送','{:url('GoodsOrders/ordersAdd')}','','600','600')">申请礼品寄送</button>-->
        <div class="layui-card-body" style="padding-left: 0;float:left;padding-left:20px;padding-top:0;">
          <form class="layui-form layui-col-space5" action="" method="get">
              <div class="layui-inline layui-show-xs-block">
                  <select name="goods_id" id="goods_id" lay-search>
                    <option value="">全部礼品</option>
                    {volist name="goodsList" id="value"}
                    <option value="{$value.id}" {$value.id==input('goods_id')?'selected':''}>{$value.goods_name}</option>
                    {/volist}
                  </select>
              </div>
              {if condition="session('group_id','','admin') != 5 && session('group_id','','admin') != 2"}
              <div class="layui-inline layui-show-xs-block">
                  <select name="admin_id" id="admin_id" lay-search>
                    <option value="">全部业务员</option>
                    {volist name="adminList" id="value"}
                    <option value="{$value.id}" {$value.id==input('admin_id')?'selected':''}>{$value.name}</option>
                    {/volist}
                  </select>
              </div>
              {/if}

              <!--<div class="layui-inline layui-show-xs-block">-->
                  <!--<select name="status" id="status">-->
                    <!--<option value="1" {:input('status')==1?'selected':''} >已发货</option>-->
                    <!--<option value="-1" {:input('status')==-1?'selected':''} >取消订单</option>-->
                    <!--<option value="0" {:input('status')=='0'?'selected':''} >待发货</option>-->
                    <!--<option value="" {:input('status')==''?'selected':''}>全部状态</option>-->
                  <!--</select>-->
              <!--</div>-->
              <!--<div class="layui-inline layui-show-xs-block">-->
                  <!--<select name="type" id="type">-->
                    <!--<option value="">出入库</option>-->
                    <!--<option value="1" {:input('type')==1?'selected':''} >入库</option>-->
                    <!--<option value="2" {:input('type')==2?'selected':''} >出库</option>-->
                  <!--</select>-->
              <!--</div>-->

              <div class="layui-inline">
                  <label>日期选择</label>
                  <div class="layui-input-inline">
                      <input type="text" name="start_date" id="start_date" value="{if condition="input('start_date')"}{:input('start_date')}{/if}" autocomplete="off" class="layui-input">
                  </div>
              </div>
              <div class="layui-inline">
                  <label>至</label>
                  <div class="layui-input-inline">
                      <input type="text" name="end_date" id="end_date" value="{if condition="input('end_date')"}{:input('end_date')}{/if}" autocomplete="off" class="layui-input">
                  </div>
              </div>
              
              <div class="layui-inline layui-show-xs-block">
                  <button class="layui-btn" id="search-btn">搜索</button>
              </div>
          </form>
        </div>
      </xblock>
      <div class="layui-table-body layui-table-main" style="width: 100%;">
      <table class="layui-table layui-form" lay-size="sm">
        <thead>
          <tr>
            <!--<th width="60">直播间id</th>-->
            <!--<th width="60">品牌</th>-->
            <!--<th width="100">礼物名称</th>-->
            <th width="160">品牌|礼物名称</th>
            <th width="50">数量</th>
            <th width="60">业务员</th>
            <th width="180">活动名称</th>
            <th width="50">收件人</th>
            <th width="80">联系方式</th>
            <th width="130">寄送地址</th>
            
            <th width="80">添加时间</th>
            <th width="60">状态</th>
            <th width="">物流最新动态</th>
            {if condition="session('group_id','','admin') == 1"}
            <th width="60">核对状态</th>
            {/if}
            <th width="100" style="text-align: center;">操作</th>
        </thead>
        <tbody>
        <!--{   volist name="list" id="value" key="key"   }-->
        <!--<tr>-->
            <!--<td>{$key}</td>-->
            <!--{volist name="value" id="v" key="k"}-->
                <!--<td>{$}</td>-->
                <!--<td>{$v}</td>-->
            <!--{/volist}-->
        <!--</tr>-->
        <!--{/volist}-->

          {volist name="list" id="value" key="k"}
          <tr>
            <!--<td>{$value.live_id}</td>-->
            <!--<td>{$value.brand}</td>-->
            <!--<td>{$value.goods_name}</td>-->
            <td>{$k}</td>
            <td>{$value.count}</td>
            <td>{:idToAdminname($value.admin_id)}</td>
            <td>{:getClientInfoById($value.client_id,'activity')}{if $value.live_id}{$value.activity_name} - {$value.live_id}{/if}</td>
            <td>{$value.consignee}</td>
            <td>{$value.phone}</td>
            <td>{$value.address}</td>

            <td>{$value.add_time|date="Y-m-d",###}</td>
            <td>
            {if condition="$value.status eq 1"}
                {$value.type==1 ? '入库成功' : '已发货'}
            {elseif condition="$value.status eq -1"}
                {$value.type==1 ? '入库失败' : '取消订单'}
            {elseif condition="$value.status eq 0"}
                {$value.type==1 ? '待审核' : '待发货'}
            {/if}
            </td>
            <td>{$value.express_last_data}</td>
            {if condition="session('group_id','','admin') == 1"}
            <td style="text-align:center;">
                {if condition="$value.check_status && $value.status eq 1"}
                <span class="layui-badge layui-bg-green"><i class="layui-icon layui-icon-ok"></i></span>
                {elseif condition="!$value.check_status && $value.status eq 1"}
                <a title="核对" class="layui-btn layui-btn-primary layui-btn-xs " lay-filter="check" lay-submit="" lay-id="{$value.id}" href="javascript:;">
                    <i class="layui-icon">核对</i>
                </a>
                {/if}
            </td>
            {/if}
            <td class="td-manage" style="text-align: center;">

                <a title="查看详情" class="layui-btn layui-btn-normal layui-btn-xs" onclick="x_admin_show('查看详情','{:url('GoodsOrders/ordersView')}/id/{$value.id}','','600','750')" href="javascript:;">查看/发货</a>
                {if condition="$value.type == 2 && $value.status == 0"}

                {/if}
            </td>
          </tr>
          {/volist}
        </tbody>
      </table>
    </div>


    </div>

    <script>
      layui.use(['form','layer','jquery','laydate'], function(){
        form = layui.form,
        layer = layui.layer
        ,$ = layui.jquery
        ,laydate = layui.laydate;

        form.on('submit(check)', function(data){
            var id = $(this).attr('lay-id');
            layer.confirm('是否已核对完成？', {icon: 3, title:'核对操作'}, function(index){
                $.ajax({
                    type:'POST',
                    dataType:'json',
                    data:{id:id},
                    url:"{:url('orderCheck')}",
                    success:function(obj){
                      
                      layer.msg(obj.msg, {icon: obj.icon,time: 2000},function(){
                        location.reload();
                      });
                    }
                });
              layer.close(index);
            });
            return false;
        });

          laydate.render({
              elem: '#start_date'
          });
          laydate.render({
              elem: '#end_date'
          });
      });

    </script>
  </body>

</html>